n = 3
all_way = {'север': 0, 'восток': 0, 'юг': 0, 'запад': 0}
coordinates = [0, 0]
for i in range(n):
    course = input().split()

        all_way[course[0]] = int(course[1])
print(all_way)
coordinates[0] = all_way['восток'] - all_way['запад']
coordinates[1] = all_way['север'] - all_way['юг']
new_coor = str(coordinates[0]) + ' ' + str(coordinates[1])
print(new_coor)